<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title></title>
<#include "/jeecms_sys/head.html"/>
<script type="text/javascript">
$(function() {
	$("#jvForm").validate();
	//processButton();
});
</script>
<style type="text/css">
.items{padding-top:1px;}
</style>
</head>
<body>

<div class="body-box">
<@p.form id="jvForm" action="o_updateProductSku.do">
<div>
	<div class="items"><input type="button" class="add_subTopic"
	 value="增加SKU" onclick="addproductSku();"/></div>
	<#list listProductSku as productSku>
		<div class="items" id="productSku${productSku_index}">
		SKU编码: <input type="text" id="skuCode${productSku_index}" name="skuCode" value="${productSku.skuCode!}" style="width:50px" readonly="readonly"/>
		&nbsp; SKU名称: <input type="text" id="skuName${productSku_index}" name="skuName" value="${productSku.skuName!}" style="width:80px"/>
		&nbsp; 销售价格: <input type="text" id="price${productSku_index}" name="price" value="${productSku.price!}" style="width:80px"/>
		&nbsp; 市场价格: <input type="text" id="priceMarket${productSku_index}" name="priceMarket" value="${productSku.priceMarket!}" style="width:80px"/>
		&nbsp; 库存数量: <input type="text" id="storeNum${productSku_index}" name="storeNum" value="${productSku.storeNum!}" style="width:80px"/>
		&nbsp; 运费: <input type="text" id="freight${productSku_index}" name="freight" value="${productSku.freight!}" style="width:80px"/>
		<input type="hidden" name="psId" value="${productSku.id}"/>
		&nbsp; <input class="del-button" type="button"  value="<@s.m "global.delete"/>" onclick="$(this).parent().remove();"/>
		</div>
	</#list>
	<div id="productSkuContainer"></div>
</div>
<@p.tr/>
<@p.td><@p.hidden name="productId" value=product.id/><@p.submit code="global.submit"/> &nbsp; <@p.reset code="global.reset"/></@p.td> 
</@p.form>
</div>

<textarea id="subTopicTpl" style="display:none;">
<div class="items">
SKU编码: <input type="text" name="skuCode" value="{0}" style="width:50px" readonly="readonly"/>
&nbsp; SKU名称: <input type="text" name="skuName" value="" style="width:80px"/>
&nbsp; 销售价格: <input type="text" name="price" value="" style="width:80px"/>
&nbsp; 市场价格: <input type="text" name="priceMarket" value="" style="width:80px"/>
&nbsp; 库存数量: <input type="text" name="storeNum" value="" style="width:80px"/>
&nbsp; 运费: <input type="text" name="freight" value="0" style="width:80px"/>

 <input type="hidden" name="paixu" value="{0}" style="width:80px"/>

<input type="hidden" name="psId" value=""/>
&nbsp; <input class="del-button" type="button" value="<@s.m "global.delete"/>" onclick="$(this).parent().remove();"/>
</div>
</textarea>
<script type="text/javascript">
var subtpl = $.format($("#subTopicTpl").val());
//商品货号+递增 = sku编码
//var subindex = ${listProductSku?size}+1;
var num=10;
var subindex=${product.itemNo};
var skuCodeMax=${skuCode};
if(skuCodeMax=="0"){
skuCodeMax=subindex+"10";
}else{
skuCodeMax=skuCodeMax+1;
}
function addproductSku() {
	//$("#productSkuContainer").append(subtpl(subindex+""+(num++)));
	$("#productSkuContainer").append(subtpl(skuCodeMax++));
}
</script>
<#include "/common/alert_message.html"/>
</body>
</html>